/**
 * Created by zhangyi on 2017/11/14.
 */
mainApp.factory("personalFactory",function() {
    var service={};

    //修改时获取数据
    var object;
    service.setAttend=function(data){
        object=data;

    }
    service.getAttend=function(){
        return object;
    }

    //获取全部列表
    service.getListData=function(currentindex){
        var obj={
            "pageIndex": currentindex,
            "pageSize": 8
        }
        var list = "";
        RequestUtils.postJson('../am/get',obj).done(function (resp) {
            if(resp.resultCode==0){
                list=resp.data;
                CommonUtils.buildFailHint("列表获取","成功");
            }else{
                CommonUtils.buildFailHint('列表获取', '失败');
            }
        });
        return list;
    };

    return service;
});

mainApp.controller("personalListController",function($scope,$http,$state,$filter,personalFactory) {
    //今天日期
    $scope.today=$filter('date')(new Date(), 'yyyy-MM-dd');

    //获取数据 全部的
    $scope.attendList=personalFactory.getListData(1);
    //获取list
    $scope.list=$scope.attendList.items;
    console.log(1275327);


    //翻页
    $scope.NextListData=function(pageIndex){
        $scope.attendList=personalFactory.getListData(pageIndex);
        $scope.list=$scope.attendList.items;
    }
});